package mutsumimod.powers;

import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.actions.utility.UseCardAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.AbstractPower;
import com.megacrit.cardcrawl.powers.BufferPower;
import mutsumimod.MutsumiMod;
import mutsumimod.cards.custom.AwakeIsRebirth;

import java.util.ArrayList;

public class AwakeIsRebirthPower extends BasePower {
    public static final String POWER_ID = MutsumiMod.makeID(AwakeIsRebirthPower.class.getSimpleName());

    public AwakeIsRebirthPower(AbstractCreature owner,int amount) {
        super(POWER_ID, PowerType.BUFF, false, owner, amount);
    }

    @Override
    public void onUseCard(AbstractCard card, UseCardAction action) {
        if(!card.type.equals(AbstractCard.CardType.ATTACK)){
            for(AbstractMonster m : AbstractDungeon.getMonsters().monsters){
                if(!m.isDeadOrEscaped()){
                    addToBot(new ApplyPowerAction(m,AbstractDungeon.player,new BreakPower(m,amount),amount));
                }
            }
        }
    }

    @Override
    public void updateDescription() {
        description = DESCRIPTIONS[0] + amount + DESCRIPTIONS[1];
    }

}
